<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"
	language="java"%>
<%@ include file="/jsp/platform/include/include.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="common" uri="/WEB-INF/tld/common_el.tld"%>
<html>
<head>
<TITLE><c:out value="${_LOGONUSER_.MANAGETITILE}" />
</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<%@ include file="/jsp/platform/include/header.jsp"%>
</HEAD>
<BODY>
	<DIV class="mains">
		<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
			<TBODY>
				<TR valign="top">
					<TD>
						<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">

							<TR>
								<TD>
									<div class="pages_con">
										<!--创建页面-->
										<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
										<TR>
											<TD>
												<div class="pages_con">

                                                    <form method="post"
															action="<%=request.getContextPath()%>/manage/merchantInfo/saveMerchantInfo"
															id="merchantInfoForm" name="merchantInfoForm"
															enctype="multipart/form-data">
															<input type="hidden" name="merchantId" value="${model.merchantId}">
															<input type="hidden" name="settleCardInfoModel.applyStatus" value="${model.settleCardInfoModel.applyStatus}">
															<input type="hidden" name="settleCardInfoModel.sysAccount" value="${model.settleCardInfoModel.sysAccount}">
															<input type="hidden" name="settleCardInfoModel.companyName" value="${model.settleCardInfoModel.companyName}">
															<input type="hidden" name="settleCardInfoModel.merchantName" value="${model.settleCardInfoModel.merchantName}">
															<input type="hidden" name="settleCardInfoModel.settleId" value="${model.settleCardInfoModel.settleId}">
															<input type="hidden" name="settleCardInfoModel.subjectType" value="${model.settleCardInfoModel.subjectType}">
															<input type="hidden" name="settleCardInfoModel.subjectId" value="${model.settleCardInfoModel.subjectId}">
													<div class="pages_con_20">

														<TABLE class="table" style="font-size:12px;">

															<THEAD style="color:#333">
																<TBODY>
																	<TR>
																		<TD><span class="tdbold">基本信息</span>
																		</td>
																	</tr>
																	<TR>
																		<TD><common:getDicListByKey key="2100"
																				var="depositBankList" /> <common:getDicListByKey
																				key="2140" var="productTypeList" /> <common:getDicListByKey
																				key="2150" var="merchantTypeList" />
																			<DIV class="transaction_external">
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">所在省份：</SPAN>
																					<INPUT name="merchantProvince"
																						value="${model.merchantProvince}" disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="merchantProvince" type="text"> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">所在城市：</SPAN>
																						<INPUT name="merchantCity"
																						value="${model.merchantCity}"  disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="merchantCity" type="text">
																				</DIV>

																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">商户名称：</SPAN>
																					<INPUT name="merchantName"
																						value="${model.merchantName}"   disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="merchantName" type="text"> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">经营地址：</SPAN>
																						<INPUT name="merchantAddr"
																						value="${model.merchantAddr}" disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="merchantAddr" type="text">
																				</DIV>

																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">法人姓名：</SPAN>
																					<INPUT name="legalName" value="${model.legalName}"  disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="legalName" type="text"> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">法人证件号：</SPAN>
																						<INPUT name="legalIdentityno"   disabled="disabled"
																						value="${model.legalIdentityno}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="legalIdentityno" type="text">
																				</DIV>
																				<DIV class="clearfix"></DIV>
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">经营范围：</SPAN>
																					<INPUT name="bussinessScope"       disabled="disabled"
																						value="${model.bussinessScope}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="bussinessScope" type="text">  <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">联系电话：</SPAN>
																						<INPUT name="telephone"   disabled="disabled"
																						value="${model.telephone}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="telephone" type="text">
																				</DIV>
																				<DIV class="clearfix"></DIV>
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">产品类型：</SPAN>
																					<SPAN class="label dl_w"
																						style="padding-left:0px;text-align:center;height:30px;width:230px;">
																						<select id="productType" name="productType">
																							<option value="">请选择</option>
																							<c:forEach var="list" items="${productTypeList}">
																								<option value="${list.dirValue}">
																									<c:out value='${list.dirCaption}' />
																								</option>
																							</c:forEach>
																					</select> </SPAN><span class="reds f_l">*</span> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">商户类型：</SPAN>
																					<SPAN class="label dl_w"
																						style="padding-left:0px;text-align:center;height:30px;width:230px;">
																						<select id="merchantType"
																						name="merchantType">
																							<option value="">请选择</option>
																							<c:forEach var="list" items="${merchantTypeList}">
																								<option value="${list.dirValue}">
																									<c:out value='${list.dirCaption}' />
																								</option>
																							</c:forEach>
																					</select>
																					</SPAN> <span class="reds f_l">*</span>
																				</DIV>
																				<DIV class="clearfix"></DIV>
																			</DIV></TD>
																	</TR>
																	<TR>
																		<TD><span class="tdbold">账户信息</span>
																		</td>
																	</tr>
																	<TR>
																		<TD>
																			<DIV class="transaction_external">
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">系统账号：</SPAN>
																					<INPUT name="sysAccount"  readonly
																						class="txtbox_cz txtbox_cz_color input_change"
																						value="${model.sysAccount}" id="sysAccount"
																						type="text"> <span class="reds f_l">*</span>
																				</DIV>
																			</DIV>
																			<DIV class="clearfix"></DIV>
																		</TD>
																	</TR>
																	<TR>
																		<TD><span class="tdbold">结算信息</span>
																		</td>
																	</tr>
																	<TR>
																		<TD>
																			<DIV class="transaction_external">
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">开户行：</SPAN>
																					<SPAN class="label dl_w"
																						style="padding-left:0px;text-align:center;height:30px;width:230px;">
																						<select id="depositBank"
																						name="settleCardInfoModel.depositBank">
																							<option value="">请选择开户行</option>
																							<c:forEach var="list" items="${depositBankList}">
																								<option value="${list.dirValue}">
																									<c:out value='${list.dirCaption}' />
																								</option>
																							</c:forEach>
																					</select> </SPAN> <span class="reds f_l">*</span> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">开户行支行：</SPAN>
																					<INPUT name="settleCardInfoModel.depositBankbranch"
																						value="${model.settleCardInfoModel.depositBankbranch}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="depositBankbranch" type="text"> <span
																						class="reds f_l">*</span>
																				</DIV>
																				<DIV class="clearfix"></DIV>
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">开户名：</SPAN>
																					<INPUT name="settleCardInfoModel.bankUsrname"
																						value="${model.settleCardInfoModel.bankUsrname}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="bankUsrname" type="text"> <span
																						class="reds f_l">*</span> <SPAN
																						class="label cz_label "
																						style="width:120px;text-align:right;">开户账号：</SPAN>
																						<INPUT name="settleCardInfoModel.bankAccount"
																						value="${model.settleCardInfoModel.bankAccount}"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="bankAccount" type="text"> <span
																							class="reds f_l">*</span>
																				</DIV>
																				<DIV class="clearfix"></DIV>
																				<DIV class="clearfix">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">T+O额度：</SPAN>
																					<INPUT name="t0Limit" value="${model.t0Limit}"    disabled="disabled"
																						class="txtbox_cz txtbox_cz_color input_change"
																						id="t0Limit" type="text"> <span
																						class="reds f_l">万元</span>
																				</DIV>
																				<DIV class="clearfix"></DIV>
																			</DIV></TD>
																	</TR>
																	<TR>
																		<TD><span class="tdbold">证件信息</span>
																		</td>
																	</tr>
																	<tr><td><span class="reds f_l">该部分无法看到图片信息有2种情况：1、用户未进行实名认证 没有图片可显示；2、已经实名认证未审核通过；</span></td></tr>
																	<TR>
																		<TD>
																			<DIV class="transaction_external">
																				<DIV class="clearfix" id="file1Div" name="fileDiv">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">身份证和信用卡：</SPAN>
																					<IMG width="300" height="400" alt="身份证和信用卡"
																						style="cursor:pointer"
																						src="${_LOGONUSER_.IMAGESETTLEPATH}/${model.sysAccount}/${model.legalIndentityImg}">
																						<br> <span class="label cz_label "
																							style="width:120px;">&nbsp;&nbsp;&nbsp;&nbsp;</span>
																							<input id="file1" type="file" name="file"
																							value="${_LOGONUSER_.IMAGESETTLEPATH}/${model.sysAccount}/${model.legalIndentityImg}"
																							style="height:31px;margin:1px 0 0 0;;width:280px;" />
																							<span class="reds">*</span>
																				</DIV>
																				<DIV class="clearfix"></DIV>
																				<DIV class="clearfix" id="file9Div" name="fileDiv">
																					<SPAN class="label cz_label "
																						style="width:120px;text-align:right;">手持身份证半身照：</SPAN>
																					<IMG width="300" height="400" alt="手持身份证半身照"
																						style="cursor:pointer"
																						src="${_LOGONUSER_.IMAGESETTLEPATH}/${model.sysAccount}/${model.holdIndentityCard}">
																						<br> <span class="label cz_label "
																							style="width:120px;">&nbsp;&nbsp;&nbsp;&nbsp;</span>
																							<input type="file" name="file" id="file9"
																							class="ehdel_upload_text" value="请选择文件"
																							style="height:31px;margin:1px 0 0 0;;width:280px;" />
																							<span class="reds">*</span>
																				</DIV>
																				
																				<DIV class="note">
																					<SPAN class="label cz_label">&nbsp;</SPAN> <A
																						class="btn confirm" href="javascript:void(0);"
																						onclick="submitForm()" style="margin-left:113px;">确定</A>
																				</DIV>
																			</DIV>
																		</TD>
																	</TR>
																</TBODY>
														</TABLE>
													</div>
													</form>
												</div>
											</TD>
										</TR>
										<!--结束-->
										</TABLE></DIV>
					</TD>
				</TR>  </TABLE></TD></TR>
			</TBODY>
		</TABLE>
	</DIV>

</BODY>
</HTML>
<script type="text/javascript">
	var indexTerminal = 0;
	function del(obj) {
		$(obj).parent().remove();
	}
	$(window).bind("load", function() {
		var merchantType = "${model.merchantType}";
		$("div[name='fileDiv']").hide();
		if (merchantType == "1" || merchantType == "2") {
			$("#file1Div").show();;
			$("#file9Div").show();
		} else if (merchantType == "3") {
			$("#file1Div").show();
			$("#file3Div").show();
			$("#file4Div").show();
			$("#file5Div").show();
			$("#file6Div").show();
			$("#file8Div").show();
		}
	});
	function myparser(s) {
		if (!s)
			return new Date();
		var ss = (s.split('-'));
		var y = parseInt(ss[0], 10);
		var m = parseInt(ss[1], 10);
		var d = parseInt(ss[2], 10);
		if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
			return new Date(y, m - 1, d);
		} else {
			return new Date();
		}
	}
	function submitForm() {			
				//检验所有字段
				var checkStr =
//								"need|merchantProvince|所在省份|"+ $("#merchantProvince").val()+";"
//				                +"need|merchantCity|所在城市|"+ $("#merchantCity").val() + ";"
//				                +"need|merchantName|商户名称|"+ $("#merchantName").val() + ";"
//				                +"need|mobilephone|手机|"+ $("#mobilephone").val() + ";"
//				                +"need|telephone|联系电话|"+ $("#telephone").val() + ";"
//				                +"need|merchantAddr|经营地址|"+ $("#merchantAddr").val() + ";"
//				                +"need|legalName|法人名字|"+ $("#legalName").val() + ";"
//				                +"need|legalIdentityno|法人证件号|"+ $("#legalIdentityno").val() + ";"
//				                +"identityNo|legalIdentityno|法人证件号|"+ $("#legalIdentityno").val() + ";"
//							    +"need|bussinessScope|经营范围|" + $("#bussinessScope").val() + ";"
//								+"need|telephone|联系电话|" + $("#telephone").val() + ";"
								//检验联系电话 
//				                +"mobile|telephone|联系电话|"+ $("#telephone").val() + ";"
								+"need|productType|产品类型|" + $("#productType").val() + ";"
								+"need|merchantType|商户类型|" + $("#merchantType").val() + ";"
								+"need|sysAccount|系统账号|" + $("#sysAccount").val() + ";"
//								+"need|sysPassword|密码|" + $("#sysPassword").val() + ";"
//								+"need|tradePassword|交易密码|" + $("#tradePassword").val() + ";"
//								+"need|depositBank|开户行|" + $("#depositBank").val() + ";"
//								+"need|depositBankbranch|开户支行|"+ $("#depositBankbranch").val() + ";"
//								+"need|bankUsrname|账户名|" + $("#bankUsrname").val() + ";"
//								+"need|bankAccount|账号|" + $("#bankAccount").val() + ";"
								+"need|t0Limit|T+O额度|" + $("#t0Limit").val() + ";"
				                //检验double
				                +"double|t0Limit|T+O额度|"+ $("#t0Limit").val() + ";"
				                ;
				var merchantType = $("#merchantType").val();
				if(merchantType=="1"||merchantType=="2"){
				               checkStr = checkStr
				              //检验文件类型
				                //检验证件信息
				                //+"need|file1|身份证和信用卡|" + $("#file1").val() + ";"
								//+"need|file2|法人身份证反面|" + $("#file2").val() + ";"
								//+"need|file7|结算银行卡正面|"+ $("#file7").val() + ";"
								//+"need|file9|手持身份证半身照|"+ $("#file9").val() + ";"
								//+"need|file10|结算银行卡|"+ $("#file10").val() + ";"
//								+"fileType|file1|身份证和信用卡|"+ $("#file1").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                //+"fileType|file2|法人身份证反面|"+ $("#file2").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                //+"fileType|file7|结算银行卡正面|"+ $("#file7").val() + "|jpg,JPG,png,PNG,gif,GIF;"
//				                +"fileType|file9|手持身份证半身照|"+ $("#file9").val() + "|jpg,JPG,png,PNG,gif,GIF;"
//				                +"fileType|file10|结算银行卡|"+ $("#file10").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                ;
				}else if(merchantType=="3"){
				                checkStr = checkStr
				                //检验证件信息
				                //+"need|file1|身份证和信用卡|" + $("#file1").val() + ";"
								//+"need|file2|法人身份证反面|" + $("#file2").val() + ";"
								//+"need|file3|营业执照|" + $("#file3").val() + ";"
								//+"need|file4|组织机构代码证|"+ $("#file4").val() + ";" 
								//+"need|file5|税务登记证|"+ $("#file5").val() + ";"
								//+"need|file6|开户银行许可证|"+ $("#file6").val() + ";" 
								//+"need|file7|结算银行卡正面|"+ $("#file7").val() + ";"
								//+"need|file8|营业场所照片|"+ $("#file8").val() + ";"
				              //检验文件类型
								+"fileType|file1|身份证和信用卡|"+ $("#file1").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                //+"fileType|file2|法人身份证反面|"+ $("#file2").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                +"fileType|file3|营业执照|"+ $("#file3").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                +"fileType|file4|组织机构代码证|"+ $("#file4").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                +"fileType|file5|税务登记证|"+ $("#file5").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                +"fileType|file6|开户银行许可证|"+ $("#file6").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                //+"fileType|file7|结算银行卡正面|"+ $("#file7").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                +"fileType|file8|营业场所照片|"+ $("#file8").val() + "|jpg,JPG,png,PNG,gif,GIF;"
				                ;
				}                     
				//检验所有规则
				if (!checkAll(checkStr)) {
					return false;
				}
				
//				if($("input[name='terminalInfo.terminalNo']").length>1){
//				   $.messager.alert("提示信息", "修改客商时终端绑定最多只能绑一个!","info",function(){
//					});
//				   return false;
//				}
				$('#merchantInfoForm').submit();

			}
			$("#merchantType").change(function(){
	        	var merchantType = $("#merchantType").val();
	        	$("div[name='fileDiv']").hide();
	        	if(merchantType == "1"||merchantType=="2"){
	        	  $("#file1Div").show();
	        	  //$("#file2Div").show();
	        	  //$("#file7Div").show();
	        	  $("#file9Div").show();
//	        	  $("#file10Div").show();
	        	}else if(merchantType == "3"){
	        	  $("#file1Div").show();
	        	  //$("#file2Div").show();
	        	  $("#file3Div").show();
	        	  $("#file4Div").show();
	        	  $("#file5Div").show();
	        	  $("#file6Div").show();
	        	  //$("#file7Div").show();
	        	  $("#file8Div").show();
	        	}
	        });
	//这句放到页面最后 edit by wenjw 2015.6.2
	$("#depositBank").val(
			"<c:out value='${model.settleCardInfoModel.depositBank}'/>");
	$("#productType").val("<c:out value='${model.productType}'/>");
	$("#merchantType").val("<c:out value='${model.merchantType}'/>");
</script>
